<template>
  <div id="app">
    <!-- <div id="nav"> -->
      <!-- <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link> -->
    <!-- </div> -->
    <keep-alive include="HomePage">
      <router-view />
    </keep-alive>
  </div>
</template>

<script>
import path from 'path'
import fs from 'fs'
// eslint-disable-next-line no-unused-vars
const ipcRenderer = require('electron').ipcRenderer

export default {
  mounted () {
    ipcRenderer.on('version', this.onVersion)
  },
  methods: {
    onVersion (e, o) {
      console.log('version: ', o)
    },
    tryWrite () {
      const outPutPath = this.outPutPath
      if (!outPutPath) return
      const pathStat = this.isExistDir(outPutPath)
      if (!pathStat) {
        console.log(outPutPath)
        fs.mkdirSync(outPutPath)
      }
      fs.writeFileSync(path.join(outPutPath, '/xxxx.txt'), '12345')
    },
    isExistDir (p) {
      try {
        const stat = fs.statSync(p)
        return stat
      } catch (e) {
        console.log(e)
        return false
      }
    }
  }
}
</script>

<style lang="stylus">
</style>
